<!DOCTYPE html>
<html>
{include file="public/header" /}
<body>


<div class="layui-fluid" id="app">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <!--<div class="layui-card-header">财务报表,提现管理</div>-->
                <div class="layui-card-body">


                    <div class="layadmin-trailer ">
                        <table class="layui-table" lay-skin="line">
                            <thead>
                            <tr>
                                <!--<th style="width: 5%;"></th>-->
                                <!--<th>#ID</th>-->
                                <th style="width: 200px">案例名称</th>
                                <!--<th>户型</th>-->
                                <!--<th>面积</th>-->
                                <th>缩略图</th>
                                <!--<th>发布时间</th>-->
                                <th>状态</th>
                                <!--<th>收藏人数</th>-->
                                <th>设为热门</th>
                                <th style="width: 150px"></th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr v-for="(item,index) in items" :data_id="item.id">
                                <!--<td style="width: 20px;text-align: center">-->
                                    <!--<input type="checkbox" class="vue_index" name="id" :value="item.id"-->
                                           <!--style="zoom: 150%">-->
                                <!--</td>-->
                                <!--<td>{{item.id}}</td>-->
                                <td>{{item.cases_name}}</td>
                                <!--<td>{{item.house_type}}</td>-->
                                <!--<td>{{item.area}}</td>-->
                                <td><img :src="item.small_img" class="layui-circle2"></td>
                                <!--<td>{{item.create_time}}</td>-->

                                <!--<td>{{item.status}}</td>-->
                                <td  v-if="item.status == 0"></td>
                                <td  v-if="item.status == 1"><i class="layui-icon">&#xe605;</i></td>

                                <!--<td>{{item.collect_number}}</td>-->
                                <td  v-if="item.remen == 0"></td>
                                <td  v-if="item.remen == 1"><i class="layui-icon">&#xe605;</i></td>
                                <td style="text-align: center">

                                    <div class="layui-btn-group">
                                        <a class="layui-btn layui-btn-sm layui-btn-primary"
                                           onclick="choose(this)"
                                           :data_id="item.id" :data_index="index">
                                            确定
                                        </a>

                                    </div>
                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                    <div id="demo7"></div>

                </div>
            </div>
        </div>
    </div>
</div>


<!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
<script>
    //vue对象
    var app = new Vue({
        el: '#app',
        data: {
            check: [],
            curr: 1,//当前页
            limit: 10,//当前页
            items: []
        }
    });

    //初始数据
    function init() {
        layer.load(2);
        $.get('/admin/cases/index', '',
            function (res) {
                layer.closeAll();
                app.items = res.data;
            }
        );
    }


    function choose(that) {

        var data_id = $(that).attr('data_id');
        ///home/shouye/cases_detail?id=12
        var url="{:url('home/shouye/cases_detail')}?id="+data_id;
        parent.set_url(url);
        parent.layer.closeAll();

    }

    //按需引入layui模块
    layui.use(['laypage', 'layer','table','element'], function () {
        var laypage = layui.laypage
            , layer = layui.layer;
        var table = layui.table;
        var elemnet = layui.element;
        //完整功能
        laypage.render({
            elem: 'demo7'
            , count: "{$count}"
            , limits: [10, 20]
            , layout: ['count', 'prev', 'page', 'next', 'limit', 'skip']
            , jump: function (obj) {
                console.log(obj)
                app.curr = obj.curr;
                app.limit = obj.limit;
                init();
            }
        });

    });

    //获取批量IDS
    function getCheckBox() {
        var check = [];
        $.each($('input[type=checkbox]:checked.vue_index'), function () {
            check.push($(this).val());
        });
        return check;
    }


    function hre(that) {
        var id=$(that).attr('data_id');
//        location.href="{:url('detail')}?id="+id;
        layer.open({

            type: 2,
            title: '案例详情',
            shadeClose: true,
            shade: 0.01,
            area: ['80%', '80%'],
            content: "{:url('detail_cases')}?id="+id //iframe的url

        })
    }


    function del2() {
        var ids = getCheckBox();
        if (ids.length > 0) {
            var index = layer.confirm('确认继续执行？', {
                btn: ['确定', '取消'] //按钮
            }, function () {
                $.post('{:url("del")}', {ids: ids}, function (res) {
                    if (res.code == 1) {
                        layer.msg(res.msg, {icon: 1});
                        $("input:checkbox").removeAttr("checked");
                        init();
                    }
                    layer.close(index);
                });
            }, function () {
                layer.close(index);
            });
        }


    }

    //按需引入layui模块
    layui.use(['laypage', 'layer', 'table', 'element'], function () {
        var laypage = layui.laypage
            , layer = layui.layer;
        var table = layui.table;
        var element = layui.element;
        var form = layui.form;
        element.on('tab(docDemoTabBrief)', function (data) {
//            console.log(this); //当前Tab标题所在的原始DOM元素
//            console.log(data.index); //得到当前Tab的所在下标
//            console.log(data.elem); //得到当前的Tab大容器
            if (data.index == 0) {
                init();
            }
        });

        /* 监听提交 */
        form.on('submit(component-form-demo1)', function (data) {

            $.post("{:url('add')}", data.field, function (res) {
                if (res.code == 1) {
                    parent.layer.msg(res.msg, {icon: 1})
                    return false;
                } else {
                    parent.layer.msg(res.msg, {icon: 2})
                    return false;
                }
            });


            return false;
        });

        init();


    });


</script>


</body>
</html>




